public  project_init
public  waiting_commands


ss0     segment     code
rseg    ss0




cxpos   equ     21h
cypos   equ     22h
str_loca_sms    equ     33h

comma_res_start equ     37h

output          equ     45h
rev_buffer      equ     46h

key_vail        bit     20h.0
rev_start       bit     20h.3         ;0
rev_stop        bit     20h.4         ;1
time_or_locat   bit     20h.5
lati_or_longti  bit     20h.7

;----------------------------------------------------------------------
;External functions for LCD operations

extrn   code(lcd_init)
extrn   code(write_com)
extrn   code(write_data)
extrn   code(delay3ms)
extrn   code(put_str)
extrn   code(uart_init)
;----------------------------------------------------------------------

dula        bit     p2.6
wela        bit     p2.7

project_init:
        call    environment_init
        call    lcd_init
        call    info_display   
        call    uart_init
        
        
        ret



environment_init:
        clr     dula
        clr     wela
        clr     key_vail
        clr     rev_start
        clr     rev_stop
        clr     lati_or_longti
        clr     time_or_locat
        mov     output,#00h
       
        mov     rev_buffer,#50h  ;keep buffer starts from 50h
        mov     comma_res_start,#0a0h           ;the beginning address for keeping result
        mov     str_loca_sms,#0e0h              ;the beginning address for saving location for sms sending
        
        ret


info_display:
        mov     cxpos,#00h
        mov     cypos,#00h
        mov     dptr,#table0
        call    put_str
        
        mov     cxpos,#00h
        mov     cypos,#01h
        mov     dptr,#table1
        call    put_str

        ret

waiting_commands:
        mov     cxpos,#00h
        mov     cypos,#00h
        mov     dptr,#table9
        call    put_str
        
        mov     cxpos,#00h
        mov     cypos,#01h
        mov     dptr,#table10
        call    put_str

        ret
        
    

table0:   db      "Init...",00h       
table1:   db      "BY ZHANG JINGYI",00h 
table9:   db      "Waiting commands",00h
table10:  db      "you have 5s...",00h

end